interface Bird {
    legs:2
}


interface Dog{
    legs:4
}

type Animals = Bird|Dog

type HasFourLegs<Animal> = Animal extends {legs:4} ? Animal :never

type FourLegs = HasFourLegs<Animals>